

ALIB=libednn.a
OBJDIR=./obj/


include config.mk

ifeq ($(DEBUG), 1) 
OPTS=-O0 -g
endif

CFLAGS+=$(OPTS)

LIB_PART = src/ src/layers src/backends
SRC = $(foreach part, $(LIB_PART), $(wildcard $(part)*.c))
SRCS = $(notdir $(SRC))
OBJ = $(patsubst %.c, %.o, $(SRCS))


OBJS = $(addprefix $(OBJDIR), $(OBJ))
DEPS = $(wildcard include/*.h) $(wildcard include/layers/*.h)


all: libednn $(ALIB) demo

libednn:
	$(MAKE) -C src

.PHONY: demo
demo:
	$(MAKE) -C demo

$(ALIB):
	$(AR) $(ARFLAGS) $@ obj/*.o

$(OBJDIR)%.o: %.c $(DEPS)
	$(CC) $(COMMON) $(CFLAGS) -c $< -o $@

obj_dir:
	mkdir obj

.PHONY: clean
clean:
	del .\libednn.a
	del .\obj\*.o

	$(MAKE) -C demo clean